home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_12_02 / allison / fatal.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-11-30  |  414 b   |  21 lines

  1. LISTING 8 - Builds a variable format string by passing a va_list to vfprintf
  2. /* fatal.c:  Exit program with an error message */
  3.  
  4. #include <stdio.h>
  5. #include <stdlib.h>
  6. #include <stdarg.h>
  7. #include <string.h>
  8.  
  9. void fatal(char *fmt, ...)
  10. {
  11.     va_list args;
  12.  
  13.     if (strlen(fmt) > 0)
  14.     {
  15.         va_start(args,fmt);
  16.         vfprintf(stderr,fmt,args);
  17.         va_end(args);
  18.     }
  19.     exit(1);
  20. }
  21.